import { i18n } from '@/config/i18n.config';
import { Tsrv } from '@/services';
import { N_grid } from '@/types';
import { Grid } from 'vxe-table/types/grid';

import func from './func';

/**
 *
 * @param grid 获取所有字段
 * @deprecated: 2.0废弃
 */
const getFields = (grid: Grid) => {
  const res: string[] = [];
  const columns = grid.getTableColumn().fullColumn;
  columns.forEach(el => {
    // if (el.property) {
    if (el.field) {
      // res.push(el.property);
      res.push(el.field);
      // if (el.property.indexOf('|') > -1) {
      if (el.field.indexOf('|') > -1) {
        // const realField = el.property.split('|')[1];
        const realField = el.field.split('|')[1];
        res.push(realField);
      }
    }
  });
  return res;
};

/**
 * 设置列的可见
 * @param grid
 * @param tableColumns
 * @param property
 * @param value
 */
const setColumnVisible = (
  grid: Grid,
  tableColumns: any,
  property: string,
  value: boolean
) => {
  const columnsObj = grid.getTableColumn();
  if (columnsObj) {
    const columns = columnsObj.fullColumn;
    for (let i = 0; i < columns.length; i++) {
      // let fieldName = columns[i].property;
      let fieldName = columns[i].field;
      // if (columns[i].property)
      if (columns[i].field)
        fieldName =
          // columns[i].property.indexOf('|') > -1
          //   ? columns[i].property.split('|')[1]
          //   : columns[i].property;
          columns[i].field.indexOf('|') > -1
            ? columns[i].field.split('|')[1]
            : columns[i].field;
      if (
        property &&
        (columns[i].type === property || fieldName === property)
      ) {
        for (let s = 0; s < tableColumns.length; s++) {
          if (tableColumns[s].field) {
            const m2oFieldName =
              tableColumns[s].field.indexOf('|') > -1
                ? tableColumns[s].field.split('|')[1]
                : tableColumns[s].field;

            if (
              tableColumns[s].field === property ||
              m2oFieldName === property
            ) {
              tableColumns[s].visible = value;
              break;
            }
          }
        }
        if (value) grid.showColumn(columns[i]);
        else grid.hideColumn(columns[i]);
      }
    }
  }
};

/**
 * 获取删除前的数据
 */

const getBeforeDeleteData = (
  grid: Grid,
  tableName: string,
  funcName: string
) => {
  const records = grid.getRecordset();
  return {
    sTableName: tableName,
    sFuncName: funcName,
    isMainTable: 0,
    sTableData: {
      insertRecords: [],
      updateRecords: [],
      removeRecords: records.removeRecords.map(el => {
        return el.FGUID;
      })
    }
  };
};

/**
 * 获取删除后的数据
 */
const getAfterDeleteData = (
  grid: Grid,
  tableName: string,
  funcName: string
) => {
  const records = grid.getRecordset();
  return {
    sTableName: tableName,
    sFuncName: funcName,
    isMainTable: 0,
    sTableData: {
      insertRecords: [],
      updateRecords: [],
      removeRecords: records.removeRecords
    }
  };
};

/**
 * 获取保存前的值
 */
const getBeforeSaveData = (grid: Grid, tableName: string, funcName: string) => {
  return {
    sTableName: tableName,
    sFuncName: funcName,
    isMainTable: 0,
    sTableData: grid.getRecordset()
  };
};

/**
 * 获取保存后的数据
 */
const getAfterSaveData = (grid: Grid, tableName: string, funcName: string) => {
  const records = grid.getRecordset();
  return {
    sTableName: tableName,
    sFuncName: funcName,
    isMainTable: 0,
    sTableData: {
      insertRecords: records.insertRecords.map(el => {
        return el.FGUID;
      }),
      updateRecords: records.updateRecords.map(el => {
        return el.FGUID;
      }),
      removeRecords: records.removeRecords.map(el => {
        return el.FGUID;
      })
    }
  };
};

/**
 * 获取数据集
 */
const getChanges = (
  grid: Grid,
  cloudData: any,
  ignoreList: any = [],
  type?: string
) => {
  const records = Tsrv.utils.clone(grid.getRecordset(), true);
  if (records) {
    let insert = records.insertRecords;
    let update = records.updateRecords;
    let remove = records.removeRecords;
    insert.reverse();
    insert = insert.map(el => {
      ignoreList.forEach(item => {
        if (el[item] !== undefined) delete el[item];
      });
      return Tsrv.utils.objToArr(el, 'field', 'value', {
        // ignore: ['_XID', 'id'], //snowID ins允许事先有值
        ignore: ['_XID'],
        ignoreRegex: ['|', '/']
      });
    });
    remove = remove.map(el => {
      return el.id;
    });

    const updates: any = [];
    const localData = Tsrv.utils.clone(grid.getTableData().fullData, true);
    const cloudDataCopy = Tsrv.utils.clone(cloudData, true);
    localData.forEach(el => {
      if (el.id) {
        let findUpdate = Tsrv.utils.find(update, item => item.id === el.id);
        if (findUpdate) {
          const cloudRd =
            Tsrv.utils.find(cloudDataCopy, item => item.id === el.id) || {};
          Object.keys(findUpdate).forEach(key => {
            if (key !== 'id') {
              if (findUpdate[key] === cloudRd[key]) {
                delete findUpdate[key];
              }
            }
          });
        } else {
          findUpdate = {};
        }
        if (el._file_) {
          findUpdate.id = el.id;
          findUpdate._file_ = el._file_;
        }
        if (Object.keys(findUpdate).length > 0) {
          const r = Tsrv.utils.objToArr(findUpdate, 'field', 'value', {
            ignore: ['_XID'].concat(ignoreList),
            ignoreRegex: ['|', '/']
          });
          if (r.length > 1) {
            updates.push(r);
          }
        }
      }
    });

    update = updates;

    if (type) {
      if (type === 'insert') {
        return insert;
      }
      if (type === 'update') {
        return update;
      }
      if (type === 'remove') {
        return remove;
      }
    }
    return {
      insertRecords: insert,
      updateRecords: update,
      removeRecords: remove
    };
  }
  return {
    insertRecords: [],
    updateRecords: [],
    removeRecords: []
  };
};

const getInsertContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'insert',
    name: i18n.t('vxe.menu.insert'),
    prefixIcon: 'wy-icon wy-insert',
    visible: true,
    disabled: !editable || !toolbarConfig.insert.auth,
    children: [
      {
        code: 'insertAbove',
        name: `${i18n.t('vxe.menu.insertAbove')} (Alt+1)`,
        visible: true,
        disabled: !editable || !toolbarConfig.insert.auth
      },
      {
        code: 'insertBelow',
        name: `${i18n.t('vxe.menu.insertBelow')} (Alt+2)`,
        visible: true,
        disabled: !editable || !toolbarConfig.insert.auth
      },
      {
        code: 'insertTop',
        name: `${i18n.t('vxe.menu.insertTop')} (Alt+3)`,
        visible: true,
        disabled: !editable || !toolbarConfig.insert.auth
      },
      {
        code: 'insertBottom',
        name: `${i18n.t('vxe.menu.insertBottom')} (Alt+3)`,
        visible: true,
        disabled: !editable || !toolbarConfig.insert.auth
      }
    ]
  };
};

const getCopyContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'copy',
    name: i18n.t('vxe.menu.copy'),
    prefixIcon: 'ivu-icon ivu-icon-ios-copy-outline',
    visible: true,
    disabled: false,
    children: [
      {
        code: 'copyCeil',
        name: i18n.t('vxe.menu.copyCeil'),
        visible: true,
        disabled: false
      },
      {
        code: 'copyRow',
        name: i18n.t('vxe.menu.copyRow'),
        visible: true,
        disabled: false
      },
      {
        code: 'copyInsert',
        name: i18n.t('vxe.menu.copyInsert'),
        visible: true,
        disabled: !editable || !toolbarConfig.insert.auth
      }
      // {
      //   code: 'copyColunm',
      //   name: i18n.t('vxe.menu.copyColunm'),
      //   visible: true,
      //   disabled: false
      // }
    ]
  };
};

const getPastContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'paste',
    name: i18n.t('vxe.menu.paste'),
    prefixIcon: 'ivu-icon ivu-icon-ios-clipboard-outline',
    visible: true,
    disabled: !toolbarConfig?.insert?.auth,
    children: [
      // {
      //   code: "pasteCeil",
      //   name: i18n.t("vxe.menu.pasteCeil"),
      //   visible: true,
      //   disabled: !editable || !toolbarConfig.insert.auth
      // },
      {
        code: 'pasteRow',
        name: i18n.t('vxe.menu.pasteRow'),
        visible: true,
        disabled: !editable || !toolbarConfig?.insert?.auth
      }
      // {
      //   code: 'pasteColunm',
      //   name: i18n.t('vxe.menu.pasteColunm'),
      //   visible: true,
      //   disabled: editable || !toolbarConfig?.pasteColumn?.auth
      // }
    ]
  };
};

const getClearContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'clear',
    name: i18n.t('vxe.menu.clear'),
    prefixIcon: 'ivu-icon ivu-icon-ios-close-circle-outline',
    visible: true,
    disabled: !editable || !toolbarConfig.insert.auth,
    children: [
      {
        code: 'clearCeil',
        name: i18n.t('vxe.menu.clearCeil'),
        visible: true,
        disabled: !editable || !toolbarConfig.insert.auth
      },
      {
        code: 'clearRow',
        name: i18n.t('vxe.menu.clearRow'),
        visible: true,
        disabled: !editable || !toolbarConfig.insert.auth
      }
    ]
  };
};

const getRemoveContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'remove',
    name: i18n.t('vxe.menu.remove'),
    prefixIcon: 'ivu-icon ivu-icon-ios-trash-outline',
    visible: true,
    disabled: !editable || !toolbarConfig.delete.auth,
    children: [
      {
        code: 'remove',
        name: i18n.t('vxe.menu.remove'),
        prefixIcon: 'ivu-icon ivu-icon-ios-remove-circle-outline',
        visible: true,
        disabled: !editable || !toolbarConfig.delete.auth
      },
      {
        code: 'directRemove',
        name: i18n.t('vxe.menu.directRemove'),
        visible: true,
        disabled: !editable || !toolbarConfig.delete.auth
      }
    ]
  };
};

const getAttachContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'attach',
    name: i18n.t('vxe.menu.attach'),
    prefixIcon: 'ivu-icon ivu-icon-ios-attach',
    visible: true,
    disabled: !editable || !toolbarConfig.insert.auth,
    children: []
  };
};

const getSetupContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'setup',
    name: i18n.t('vxe.menu.setup'),
    visible: toolbarConfig.edit.auth,
    disabled: !toolbarConfig.edit.auth
  };
};

const getModifyContext = (toolbarConfig: any, editable?: boolean) => {
  return {
    code: 'modify',
    name: i18n.t('vxe.menu.edit'),
    visible: !!editable && toolbarConfig.edit.auth,
    disabled: !toolbarConfig.edit.auth
  };
};

/**
 * 获取列index
 */
const getVisibleColumnIndexByField = (grid: Grid, field: string): number => {
  const columns = grid.getTableColumn().visibleColumn;
  let index = -1;
  for (let i = 0; i < columns.length; i++) {
    // if (columns[i].property === field) {
    if (columns[i].field === field) {
      index = i;
      break;
    }
  }
  return index;
};

/**
 * 设置sortID，排序
 * @deprecated:2.0已废弃 改为 obaseGrid updateSortNum
 */
const updateSortID = (grid: Grid, type: null | number) => {
  let sortID = 0;
  const data = grid.getTableData().visibleData;
  data.forEach(el => {
    if (el.id === null) {
      sortID += 0.000001;
      el._sort_ = sortID;
    } else {
      if (el._sort_ && el._sort_ !== null) {
        sortID = el._sort_;
      }
    }
  });
};

/**
 * 表尾规则
 */
const footerMethod = (
  { columns, data },
  isRemote: boolean,
  footerData: any
) => {
  const res = columns.map((column, columnIndex) => {
    if (columnIndex === 0) {
      // return "汇总";
      return i18n.t('oSetupPanel.SetupAttrLibfield.summary');
    }
    if (column.params) {
      const method = column.params.footerMethod;
      if (method !== undefined) {
        if (isRemote) {
          let result = '';
          switch (method) {
            case 1:
              // result = "平均值: ";
              result = i18n
                .t('oSetupPanel.SetupAttrLibfield.averagevalue')
                .toString();
              break;
            case 2:
              // result = "最大值: ";
              result = i18n.t('oSetupPanel.SetupAttrLibfield.max').toString();
              break;
            case 3:
              // result = "最小值: ";
              result = i18n.t('oSetupPanel.SetupAttrLibfield.min').toString();
              break;
            default:
              break;
          }
          return result + (footerData[column.property] || 0);
        }
        let result: number | null = null;
        switch (method) {
          case 0:
            result = Tsrv.utils.sum(data, column.property);
            break;
          case 1:
            result = Tsrv.utils.mean(data, column.property);
            break;
          case 2:
            result = Tsrv.utils.get(
              Tsrv.utils.max(data, column.property),
              column.property
            );
            break;
          case 3:
            result = Tsrv.utils.get(
              Tsrv.utils.min(data, column.property),
              column.property
            );
            break;
          default:
            break;
        }
        return column.formatter
          ? func.numberFormatter(result, column.formatter[1])
          : result;
      }
    }
    return null;
  });
  return [res];
};

const getRenderType = (
  oriType: string,
  formatType: string,
  params: {
    isM2o: boolean;
    isSelection: boolean;
    isAuxProp: boolean;
  }
) => {
  // 渲染器类型
  if (
    oriType === 'int' ||
    oriType === 'dec' ||
    oriType === 'decimal' ||
    oriType === 'smallint'
  ) {
    oriType = 'number';
  } else if (
    oriType === 'varchar' ||
    oriType.indexOf('text') > -1 ||
    oriType === 'bigint' ||
    oriType === 'json'
  ) {
    oriType = 'text';
  }
  if (formatType === 'i18n') {
    oriType = 'i18n';
  } else if (formatType === 'file') {
    oriType = 'file';
  } else if (formatType === 'image') {
    oriType = 'image';
  } else if (formatType === 'color') {
    oriType = 'color';
  } else if (formatType === 'richText') {
    oriType = 'richText';
  } else if (formatType === 'control') {
    oriType = 'control';
  }
  if (params.isM2o) {
    oriType = 'm2o';
  } else if (params.isSelection) {
    oriType = 'selection';
  } else if (params.isAuxProp) {
    oriType = 'aux';
  }
  return oriType;
};

const getRender = (
  maiFunName: string,
  column: N_grid.TableColumn,
  type: string,
  formatType: string,
  dbType: string,
  lang: string,
  params: {
    formatter: any;
    selectionID: string;
    auxProp: string;
    actions: any;
    events: object;
    imgHeight?: number;
  },

  Tcommand: any = null /* 当前组件指挥类 */
) => {
  // 渲染器动作
  if (params.actions) {
    column.editRender.attrs['actions'] = params.actions;
  }
  // slc m2o 关联过滤
  if (column.params.source?.cascadeFilter) {
    column.editRender.props['cascadeFilter'] =
      column.params.source.cascadeFilter ?? '';
  }
  for (const ev in params.events) {
    column.editRender.events[ev] = params.events[ev];
  }
  // 当前组件控制类
  column.editRender.props['getTcommand'] = () => Tcommand;
  // 渲染器属性
  if (params.formatter.type === 'icon') {
    column.editRender.name = 'oIconbox';
    column.editRender.props['type'] = 'oIconbox';
  } else {
    switch (type) {
      case 'number':
        column.editRender.name = 'oNumberInput';
        break;
      case 'bit':
        column.editRender.name = 'oSwitch';
        break;
      case 'text':
        column.editRender.name = 'oInput';
        if (formatType === 'number') {
          column.formatter = ['numberFormatter', params.formatter];
        } else if (formatType === 'i18n') {
          column.formatter = ['i18nFormatter', params.formatter];
        } else if (formatType === 'icon') {
          column.editRender.props['format'] = 'icon';
        }
        break;
      case 'datetime':
        column.editRender.name = 'oDatePicker';
        column.editRender.props['type'] = 'datetime';
        column.editRender.props['format'] = 'yyyy-MM-dd HH:mm:ss';
        column.editRender.props['dataFormat'] =
          length === 3 ? 'yyyy-MM-dd HH:mm:ss.SSS' : 'yyyy-MM-dd HH:mm:ss';
        column.editRender.formatter = func.timeFormatter;
        break;
      case 'date':
        column.editRender.name = 'oDatePicker';
        column.editRender.props['type'] = 'date';
        column.editRender.props['format'] = 'yyyy-MM-dd';
        column.editRender.props['dataFormat'] = 'yyyy-MM-dd';
        column.editRender.formatter = func.timeFormatter;
        break;
      case 'time':
        column.editRender.name = 'oDatePicker';
        column.editRender.props['type'] = 'time';
        column.editRender.props['format'] = 'HH:mm:ss';
        column.editRender.props['dataFormat'] = 'HH:mm:ss';
        column.editRender.formatter = func.timeFormatter;
        break;
      case 'i18n':
        column.editRender.name = 'oI18nSelector';
        break;
      case 'm2o':
        column.editRender.name = 'oM2oSelector';
        break;
      case 'selection':
        column.editRender.name = 'oSelect';
        column.editRender.props['optionId'] = params.selectionID;
        column.editRender.props['dbType'] = dbType;
        // 改在o-select动态查询
        // if (!Tsrv.utils.noValue(column.params.source.cascadeFilter)) {
        //   const p = {
        //     inputArgs: [
        //       { name: 'funName', dataType: 'string', value: maiFunName ?? '' },
        //       {
        //         name: 'fieldName',
        //         dataType: 'string',
        //         value: column.params.source.name ?? ''
        //       }
        //     ],
        //     outputArgs: [{ name: 'data', dataType: 'string', value: '' }]
        //   };
        //   Tsrv.doEvent(
        //     column.params.source.cascadeFilter,
        //     Tsrv.getFunInfo(maiFunName) as ifs.I_funInfo,
        //     () => p
        //   )
        //     .then(resp => {
        //       if (resp.isErr()) {
        //         console.error(resp.errmsg);
        //       } else {
        //         Tsrv.getSLCData(params.selectionID, dbType, lang).then(res => {
        //           const [b, rows, msg] = res;
        //           column.editRender.props.optionLoaded = rows;

        //         });
        //       }
        //     })
        //     .catch(er => {
        //       console.error(er);
        //     });
        // } else {
        //   Tsrv.getSLCData(params.selectionID, dbType, lang).then(res => {
        //     const [b, rows, msg] = res;
        //     column.editRender.props.optionLoaded = rows;
        //     column.editRender.props['dbType'] = dbType;
        //   });
        // }

        break;
      case 'aux':
        column.editRender.name = 'oAuxInput';
        column.editRender.props['inputColumn'] = params.auxProp;
        break;
      case 'file':
        column.editRender.name = 'oFileInput';
        break;
      case 'image':
        column.editRender.name = 'oImageSelector';
        column.editRender.props['imgHeight'] =
          params.imgHeight === undefined && params.imgHeight === 1
            ? '120px'
            : `${params.imgHeight}px`;
        break;
      case 'color':
        column.editRender.name = 'oColorSelector';
        break;
      case 'richText':
        column.editRender.name = 'oRichText';
        break;
      case 'control':
        column.editRender.name = 'oControl';
        break;
      case 'multiselection':
        column.editRender.name = 'oMultiSelector';
        // 后期换成动态组装
        column.editRender.props['multiOptions'] =
          column.params.source.multiOptions;
        break;

      default:
        console.warn(`渲染未定义的类型[${type}]`);
        break;
    }
  }
};

/**
 * 通过行数据库ID修改数据
 */
const setRowDataById = (grid: Grid, id: number, row: any) => {
  id = Tsrv.utils.toInteger(id);
  const data = grid.getTableData().fullData;
  const find = Tsrv.utils.find(data, el => el.id === id);
  if (find) {
    for (const key in row) {
      if (key !== 'id') {
        find[key] = row[key];
      }
    }
  }
};

/**
 * @Author: ssj
 * @param {any} row
 * @param {any} conditions
 * @return {boolean} 验证是否通过
 * @description: 修改单元格规则
 */
const verifyRules = (row: any, conditions: any): boolean => {
  let flag: boolean = false;
  for (let i = 0; i < conditions.length; i++) {
    if (row[conditions[i].field] !== undefined) {
      if (conditions[i].type === 'number') {
        // eslint-disable-next-line no-use-before-define
        flag = testNumber(
          conditions[i].operator,
          conditions[i].value,
          row[conditions[i].field]
        );
      } else if (conditions[i].type === 'text') {
        // eslint-disable-next-line no-use-before-define
        flag = testString(
          conditions[i].operator,
          conditions[i].value,
          row[conditions[i].field]
        );
      } else {
        flag = false;
      }
      if (!flag) break;
    } else {
      flag = false;
      break;
    }
  }
  return flag;
};

/**
 * @Author: ssj
 * @param {string} op 规则符号
 * @param {string} value value值
 * @param {string} data 数据值
 * @return {boolean} 验证是否通过
 * @description: 验证number
 */
const testNumber = (
  op: string,
  value: string | number | string[] | number[],
  data: string | number
): boolean => {
  data = Tsrv.utils.toNumber(data);
  let valueArr: number[] = [];
  if (typeof value === 'string') {
    if (value.indexOf('-') > -1) {
      valueArr = value.split('-').map(el => {
        return Tsrv.utils.toNumber(el);
      });
    } else {
      valueArr = [Tsrv.utils.toNumber(value)];
    }
  }
  switch (op) {
    case '=':
      return data === valueArr[0];
    case '!=':
      return data !== valueArr[0];
    case '>':
      return data > valueArr[0];
    case '<':
      return data < valueArr[0];
    case '>=':
      return data >= valueArr[0];
    case '<=':
      return data <= valueArr[0];
    case 'between':
      return data >= valueArr[0] && data <= valueArr[1];
    case 'nbetween':
      return data < valueArr[0] || data > valueArr[1];
    default:
      return false;
  }
};

/**
 * @Author: swc
 * @param {string} op 规则符号
 * @param {string} value value值
 * @param {string} data 数据值
 * @return {boolean} 验证是否通过
 * @description: 验证string
 */
const testString = (
  op: string,
  value: string | number,
  data: string | number | null | undefined
): boolean => {
  if (typeof value !== 'string') {
    value = value.toString();
  }
  if (typeof data !== 'string') {
    data = data.toString();
  }
  switch (op) {
    case 'has':
      return data.indexOf(value) > -1;
    case 'nhas':
      return data.indexOf(value) === -1;
    default:
      return false;
  }
};

/**
 * @Author: ssj
 * @param {string} field
 * @return {string} field
 * @description: 列转换方法
 */
const getRealField = (field: string): string => {
  if (field.indexOf('|') > -1) {
    const fieldSplit = field.split('|');
    if (fieldSplit[0] === 'm2o') {
      return fieldSplit[1];
    }
    if (fieldSplit[0] === 'slc') {
      return fieldSplit[1];
    }
  }
  return field;
};

/**
 * @Author: ssj
 * @param {string} type
 * @return {boolean} defaultVal
 * @description: 通过render类型获取默认值
 */
const getColumnDefaultVal = (column: any): string | boolean => {
  let type: string = '';
  let defaultVal: string | boolean = '';
  // eslint-disable-next-line no-prototype-builtins
  if (column.hasOwnProperty('editRender')) {
    type = column.editRender.name;
  }

  switch (type) {
    case 'Input':
      break;
    case 'iSwitch':
      defaultVal = true;
      break;

    default:
      break;
  }
  return defaultVal;
};

/**
 * @Author: ssj
 * @param {any} columns
 * @return {*} rules
 * @description: 配置验证规则
 */
const getValidRules = (columns: any) => {
  const rules: any = {};
  columns.forEach((el: any) => {
    rules[el.field] = [];
    if (el.isShow) {
      rules[el.field].push({
        required: !!el.required,
        message: i18n.t('warm.mustFill')
      });
    }
  });
  return rules;
};

export default {
  // getFields,
  setColumnVisible,
  getBeforeDeleteData,
  getAfterDeleteData,
  getBeforeSaveData,
  getAfterSaveData,
  getChanges,
  getInsertContext,
  getCopyContext,
  getClearContext,
  getRemoveContext,
  getAttachContext,
  getPastContext,
  getSetupContext,
  getModifyContext,
  getVisibleColumnIndexByField,
  /**
   *
   * @deprecated:2.0已废弃 改为 obaseGrid updateSortNum
   */
  updateSortID,
  getRender,
  getRenderType,
  setRowDataById,
  footerMethod,
  verifyRules,
  getRealField,
  getColumnDefaultVal,
  getValidRules
};
